/**
 * Created by apple on 2016/11/16.
 */
module.exports = function(sequelize, DataTypes) {
	var Department = sequelize.define('department', {
		id: {
			type: DataTypes.INTEGER,
			allowNull: false,
			unique: true,
			primaryKey: true
		},
		name: {
			type: DataTypes.STRING,
			allowNull: false
		},
		pid: {
			type: DataTypes.INTEGER,
			allowNull: false
		},
		information: {
			type: DataTypes.STRING,
			allowNull: false
		}
	}, {
		underscore: true,
		'timestamps': false,
		'createdAt': false,
		'updatedAt': false
	}, {
        classMethods: {
            associate: function (models) {
                Department.hasMany(models.Doctor);
            }
        }
    });

	return Department;
};